class Websitearticles2Controller < ApplicationController
before_filter :authorize
    layout "websitearticles5"

      active_scaffold :article do |config|
  config.label = "Articles"

  config.show.link.label = "Show Detail"  
  config.show.link.type = :record
  config.show.link.inline = true
  config.show.link.position = :after 
  
   config.actions.exclude :create,:update,:delete
    config.columns[:category].label = 'Category 1' 	
    config.columns[:categoryt].label = 'Category 2'
    
    config.columns[:published].form_ui = :checkbox    
    config.columns[:user_published_by].label = 'Alias' 	  
#    config.columns[:published].inplace_edit = true
	  config.columns = [:title,:synopsis,:category,:categoryt,:body,:created_by,:created_at,:published,:published_at,:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user,:user_published_by]
    config.list.columns.exclude :body,:category,:categoryt,:created_by,:created_at,:published,:published_at,:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user	
    
		    config.nested.add_link("Comments List", [:comments]) 
   		 config.columns[:comments].search_sql = "CONCAT(comments.title,comments.body,comments.aliasn)"    
		 config.search.columns << :comments    


    config.show.columns.exclude(:title,:synopsis,:created_by,:created_at,:published,:published_at,:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user,:user_published_by)       	
  config.show.label = "Show Detail"

  end
  
  def show
    super
 # redirect_to  :controller => 'index'
 # return
    @article = Article.find(params[:id])
    @article.last_accessed_user = User.find(session[:user_id]).name
    @article.last_accessed_at = Time.now
    @article.save
   #  redirect_to  :controller => 'websitesinfs',:action=>'show'
  end




  
  def conditions_for_collection

   ['articles.websitesinf_id = ?',params[:id] ]
  end
  
 

end
